class AddIndexes < ActiveRecord::Migration
  def self.up
    add_index :users, :photo_id
    add_index :comments, :user_id
    add_index :comments, :commentable_id
    add_index :comments, :commentable_type
    add_index :documents, :attachable_id
    add_index :documents, :attachable_type
    add_index :friendships, :user_id
    add_index :friendships, :friend_id
    add_index :groups, :user_id
    add_index :groups, :category_id
    add_index :groups, :memberships_count
    add_index :memberships, :user_id
    add_index :memberships, :group_id
    add_index :photos, :parent_id
    add_index :posts, :user_id
    add_index :posts, :group_id
    add_index :posts, :type
    add_index :schools, :user_id
    add_index :schools, :degree_id
  end

  def self.down
    remove_index :users, :photo_id
    remove_index :comments, :user_id
    remove_index :comments, :commentable_id
    remove_index :comments, :commentable_type
    remove_index :documents, :attachable_id
    remove_index :documents, :attachable_type
    remove_index :friendships, :user_id
    remove_index :friendships, :friend_id
    remove_index :groups, :user_id
    remove_index :groups, :category_id
    remove_index :groups, :memberships_count
    remove_index :jobs, :user_id
    remove_index :memberships, :user_id
    remove_index :memberships, :group_id
    remove_index :photos, :parent_id
    remove_index :posts, :user_id
    remove_index :posts, :group_id
    remove_index :posts, :type
    remove_index :schools, :user_id
    remove_index :schools, :degree_id
  end
end
